
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>NPM · 尹自强.Note</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="尹自强">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-advanced-emoji/emoji-website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../styles/yzq.css">
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="Npm.html" />
    
    
    <link rel="prev" href="Nuget.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://github.com/554393109" target="_blank" class="custom-link">作者GitHub</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    在线笔记
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="Golang.html">
            
                <a href="Golang.html">
            
                    
                    Golang
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="Golang.html">
            
                <a href="Golang.html#安装与配置">
            
                    
                    安装与配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="Golang.html">
            
                <a href="Golang.html#语法">
            
                    
                    语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="Golang.html">
            
                <a href="Golang.html#常用命令">
            
                    
                    常用命令
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="Git.html">
            
                <a href="Git.html">
            
                    
                    Git
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="Git.html">
            
                <a href="Git.html#版本管理流程">
            
                    
                    版本管理流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="Git.html">
            
                <a href="Git.html#常用命令">
            
                    
                    常用命令
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="GitBook.html">
            
                <a href="GitBook.html">
            
                    
                    GitBook
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="GitBook.html">
            
                <a href="GitBook.html#项目结构">
            
                    
                    项目结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="GitBook.html">
            
                <a href="GitBook.html#常用插件">
            
                    
                    常用插件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="GitBook.html">
            
                <a href="GitBook.html#常用命令">
            
                    
                    常用命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="GitBook.html">
            
                <a href="GitBook.html#常见问题">
            
                    
                    常见问题
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="Nuget.html">
            
                <a href="Nuget.html">
            
                    
                    Nuget
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="Nuget.html">
            
                <a href="Nuget.html#私有源服务器搭建">
            
                    
                    私有源服务器搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="Nuget.html">
            
                <a href="Nuget.html#nuspec文件解析">
            
                    
                    nuspec文件解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="Nuget.html">
            
                <a href="Nuget.html#常用命令">
            
                    
                    常用命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="Nuget.html">
            
                <a href="Nuget.html#相关资源">
            
                    
                    相关资源
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter active" data-level="1.6" data-path="Npm.html">
            
                <a href="Npm.html">
            
                    
                    NPM
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="Npm.html">
            
                <a href="Npm.html#常用命令">
            
                    
                    常用命令
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="SiteConsole.html">
            
                <a href="SiteConsole.html">
            
                    
                    网站Console
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="Docker.html">
            
                <a href="Docker.html">
            
                    
                    Docker
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="Docker.html">
            
                <a href="Docker.html#Dockerfile">
            
                    
                    Dockerfile
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="Docker.html">
            
                <a href="Docker.html#常用命令">
            
                    
                    常用命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="Docker.html">
            
                <a href="Docker.html#常用镜像">
            
                    
                    常用镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="Docker.html">
            
                <a href="Docker.html#相关资源">
            
                    
                    相关资源
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="Skill.html">
            
                <a href="Skill.html">
            
                    
                    技巧
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="Tools.html">
            
                <a href="Tools.html">
            
                    
                    常用工具
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="bio.html">
            
                <a href="bio.html">
            
                    
                    个人履历
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >NPM</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#&#x56FD;&#x5185;&#x955C;&#x50CF;&#x52A0;&#x901F;"><b>1. </b>&#x56FD;&#x5185;&#x955C;&#x50CF;&#x52A0;&#x901F;</a></li><li><span class="title-icon "></span><a href="#&#x5E38;&#x7528;&#x547D;&#x4EE4;"><b>2. </b>&#x5E38;&#x7528;&#x547D;&#x4EE4;</a></li></ul></div><a href="#&#x56FD;&#x5185;&#x955C;&#x50CF;&#x52A0;&#x901F;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><p><b style="font-size: 2em">Npm</b></p>
<hr>
<h1 id="&#x56FD;&#x5185;&#x955C;&#x50CF;&#x52A0;&#x901F;"><a name="&#x56FD;&#x5185;&#x955C;&#x50CF;&#x52A0;&#x901F;" class="anchor-navigation-ex-anchor" href="#&#x56FD;&#x5185;&#x955C;&#x50CF;&#x52A0;&#x901F;"><i class="fa fa-link" aria-hidden="true"></i></a>1. &#x56FD;&#x5185;&#x955C;&#x50CF;&#x52A0;&#x901F;</h1>
<pre class="language-"><code class="lang-bash">// &#x65B9;&#x5F0F;1&#xFF1A;&#x4FEE;&#x6539;npm&#x6E90;&#x5730;&#x5740;&#x3010;&#x63A8;&#x8350;&#x8FD9;&#x4E2A;&#xFF0C;&#x56E0;&#x4E3A;&#x4E0D;&#x7528;&#x5B89;&#x88C5;&#x5176;&#x4ED6;&#x7684;&#xFF0C;&#x540C;&#x65F6;&#x539F;&#x6C41;&#x539F;&#x5473;&#x3011;
<span class="token operator">&gt;</span> <span class="token function">npm</span> config <span class="token builtin class-name">set</span> registry https://registry.npmmirror.com

// &#x65B9;&#x5F0F;2&#xFF1A;&#x4F7F;&#x7528;&#x963F;&#x91CC;&#x7684;cnpm&#x547D;&#x4EE4;&#x884C;&#x5DE5;&#x5177;&#x4EE3;&#x66FF;npm&#x547D;&#x4EE4;&#x884C;
<span class="token operator">&gt;</span> <span class="token function">npm</span> <span class="token function">install</span> <span class="token parameter variable">-g</span> cnpm <span class="token parameter variable">--registry</span><span class="token operator">=</span>https://registry.npmmirror.com

// &#x8BBE;&#x7F6E;&#x597D;&#x4E4B;&#x540E;&#xFF0C;&#x67E5;&#x770B;&#x662F;&#x5426;&#x914D;&#x7F6E;&#x6210;&#x529F;
<span class="token operator">&gt;</span>  <span class="token function">npm</span> config <span class="token function">ls</span>
</code></pre>
<blockquote>
<p>; &quot;builtin&quot; config from C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm\npmrc  </p>
<p>prefix = &quot;C:\Users\Administrator\AppData\Roaming\npm&quot;<br>; &quot;user&quot; config from C:\Users\Administrator.npmrc<br>registry = &quot;<a href="https://registry.npmmirror.com/" target="_blank">https://registry.npmmirror.com/</a>&quot;<br>; node bin location = C:\PROGRA~1\nodejs\node.exe<br>; cwd = C:\Users\Administrator<br>; HOME = C:\Users\Administrator<br>; Run <code>npm config ls -l</code> to show all defaults.</p>
</blockquote>
<hr>
<h1 id="&#x5E38;&#x7528;&#x547D;&#x4EE4;"><a name="&#x5E38;&#x7528;&#x547D;&#x4EE4;" class="anchor-navigation-ex-anchor" href="#&#x5E38;&#x7528;&#x547D;&#x4EE4;"><i class="fa fa-link" aria-hidden="true"></i></a>2. &#x5E38;&#x7528;&#x547D;&#x4EE4;</h1>
<pre class="language-"><code class="lang-bash">// &#x67E5;&#x770B;&#x57FA;&#x672C;&#x914D;&#x7F6E;&#xFF0C;&#x540E;&#x9762;&#x589E;&#x52A0;&#x53C2;&#x6570;-l&#x80FD;&#x67E5;&#x770B;&#x6240;&#x6709;&#x914D;&#x7F6E;
<span class="token function">npm</span> config <span class="token function">ls</span> <span class="token punctuation">[</span>-l<span class="token punctuation">]</span>

// &#x67E5;&#x770B;&#x67D0;&#x4E2A;&#x914D;&#x7F6E;
<span class="token function">npm</span> config get <span class="token punctuation">{</span>&#x914D;&#x7F6E;&#x540D;<span class="token punctuation">}</span>

// &#x8BBE;&#x7F6E;&#x67D0;&#x4E2A;&#x914D;&#x7F6E;
<span class="token function">npm</span> config <span class="token builtin class-name">set</span> <span class="token punctuation">{</span>&#x914D;&#x7F6E;&#x540D;<span class="token punctuation">}</span> <span class="token string">&quot;{&#x914D;&#x7F6E;&#x503C;}&quot;</span>

// &#x5B89;&#x88C5;&#x4F9D;&#x8D56;&#xFF0C;&#x6CA1;&#x5E26;&#x4EFB;&#x4F55;&#x53C2;&#x6570;&#x4F1A;&#x76F4;&#x63A5;&#x5B89;&#x88C5;&#x5BF9;&#x5E94;&#x76EE;&#x5F55;&#x4E0B;&#xFF0C;package.json&#x4E2D;&#x58F0;&#x660E;&#x7684;&#x4F9D;&#x8D56;&#x5305;
<span class="token function">npm</span> <span class="token function">install</span>

// &#x5378;&#x8F7D;&#x4F9D;&#x8D56;&#x5305;
<span class="token function">npm</span> uninstall pkg

// &#x5378;&#x8F7D;pkg&#xFF0C;&#x4F46;&#x662F;&#x4E0D;&#x4F1A;&#x4ECE;package.json&#x3001;package-lock.json&#x4E2D;&#x5220;&#x9664;&#xFF0C;&#x4ECD;&#x4FDD;&#x7559;
<span class="token function">npm</span> uninstall pkg --no-save

// &#x67E5;&#x770B;&#x5F53;&#x524D;&#x76EE;&#x5F55;&#x4E0B;&#x5B89;&#x88C5;&#x7684;&#x6240;&#x6709;&#x5B89;&#x88C5;&#x5305;&#x53CA;&#x5176;&#x4F9D;&#x8D56;&#x5305;
<span class="token function">npm</span> <span class="token function">ls</span>

// &#x67E5;&#x770B;&#x5168;&#x5C40;&#x5B89;&#x88C5;&#x7684;npm&#x5305;&#x7248;&#x672C;
<span class="token function">npm</span> <span class="token function">ls</span> <span class="token parameter variable">-g</span> <span class="token punctuation">{</span>package_name<span class="token punctuation">}</span>

// &#x67E5;&#x770B;&#x5F53;&#x524D;&#x76EE;&#x5F55;&#x4E0B;&#x5B89;&#x88C5;&#x7684;npm&#x5305;&#x7248;&#x672C;
<span class="token function">npm</span> <span class="token function">ls</span> <span class="token punctuation">{</span>package_name<span class="token punctuation">}</span>

// &#x67E5;&#x770B;&#x8FDC;&#x7A0B;npm&#x4ED3;&#x5E93;&#x4E2D;&#x6700;&#x65B0;&#x7684;npm&#x5305;&#x7248;&#x672C;
<span class="token function">npm</span> view <span class="token punctuation">{</span>package_name<span class="token punctuation">}</span> version

// &#x68C0;&#x67E5;&#x4E91;&#x7AEF;&#x7684;&#x7248;&#x672C;&#x4FE1;&#x606F;&#xFF0C;&#x5BF9;&#x6BD4;&#x672C;&#x5730;&#x5B89;&#x88C5;&#x5305;&#x7684;&#x7248;&#x672C;&#x89C4;&#x5219;&#xFF0C;&#x7136;&#x540E;&#x66F4;&#x65B0;&#x5230;&#x5BF9;&#x5E94;&#x89C4;&#x5219;&#x7684;&#x6700;&#x65B0;&#x7248;&#x672C;
<span class="token function">npm</span> update

// &#x5347;&#x7EA7;&#x5168;&#x5C40;&#x5B89;&#x88C5;&#x7684;&#x4F9D;&#x8D56;&#x5305;
<span class="token function">npm</span> update <span class="token parameter variable">-g</span>

// &#x6E05;&#x9664;npm&#x7F13;&#x5B58;
<span class="token function">npm</span> cache clean <span class="token parameter variable">--force</span>
</code></pre>
<hr>
<footer class="page-footer"><span class="copyright">&#xA9; &#x5C39;&#x81EA;&#x5F3A; all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification"><a id="link_icp" href="http://www.beian.miit.gov.cn/" target="_blank">&#x7CA4;ICP&#x5907;18161097&#x53F7;</a>&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;
2024-05-11 10:16:51
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="Nuget.html#相关资源" class="navigation navigation-prev " aria-label="Previous page: 相关资源">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="Npm.html#常用命令" class="navigation navigation-next " aria-label="Next page: 常用命令">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"NPM","level":"1.6","depth":1,"next":{"title":"常用命令","level":"1.6.1","depth":2,"anchor":"#常用命令","path":"chapter/Npm.md","ref":"chapter/Npm.md#常用命令","articles":[]},"previous":{"title":"相关资源","level":"1.5.4","depth":2,"anchor":"#相关资源","path":"chapter/Nuget.md","ref":"chapter/Nuget.md#相关资源","articles":[]},"dir":"ltr"},"config":{"plugins":["-sharing","-lunr","-search","search-pro","anchor-navigation-ex","splitter","github","tbfed-pagefooter","prism","alerts","donate","copy-code-button","advanced-emoji","expandable-chapters"],"styles":{"website":"styles/yzq.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"&copy 尹自强","modify_label":"<a id='link_icp' href='http://www.beian.miit.gov.cn/' target='blank'>粤ICP备18161097号</a>文件修订时间","modify_format":"YYYY-MM-DD HH:mm:ss"},"prism":{},"github":{"url":"https://github.com/554393109"},"splitter":{},"search-pro":{},"donate":{"alipay":"../../assets/donate_alipay.jpg","alipayText":"支付宝打赏","button":"打赏","title":"","wechat":"../../assets/donate_wechat.jpg","wechatText":"微信打赏"},"fontsettings":{"theme":"white","family":"sans","size":1},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":true},"alerts":{},"copy-code-button":{},"advanced-emoji":{"embedEmojis":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"尹自强","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"尹自强.Note","language":"zh-hans","links":{"sidebar":{"作者GitHub":"https://github.com/554393109"}},"gitbook":"3.2.3","description":"尹自强.Note"},"file":{"path":"chapter/Npm.md","mtime":"2024-05-11T02:16:51.764Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2025-01-16T03:02:01.896Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-alerts/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

